/**
 * 用长连接轮询和websocket封装
 */
(function(){

    function ajax(ops){

        ops.data=ops.data || '';
        ops.succ=ops.succ || function(){};
        ops.fail=ops.fail || function(){};
        ops.pending=ops.pending || function(){};
        ops.start=ops.start || function(){};

        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange=function(){
            if(xhr.readyState==4){
                if(xhr.status==200){
                    ops.succ(xhr.responseText);
                }else{
                    ops.fail(xhr);
                }
            }else{
                ops.pend(xhr);
            }
        }

        //xhr.timeout = ops.timeout || 60;

        xhr.open('post',ops.url,true);
        ops.start();
        xhr.send(ops.data);
        return xhr;
    }

})();
(function(){
    var ws,reqed,url;
    if(window.WebSocket){
        ws = window.WebSocket(url);
    }


    function comt(url){
        this.url = url;
        this.onopen=function(){};
        this.onclose=function(){};
        this.onmessage=function(){};
        this.init();
    }

    comt.prototype.init=function(){

    }

    comt.prototype.send=function(){

    };

})();